package com.lkm.market2_0.m_imple.steelyardserver.server.sendtask;

import com.lkm.frame.P;
import com.lkm.frame.task2.ITaskExecutor;
import com.lkm.frame.task2.TaskManager;
import com.lkm.hardware_connect.IHardwareControler;
import com.lkm.market2_0.help.UIP;
import com.lkm.market2_0.m_imple.steelyardserver.server.AbsSendWriteTask;
import com.lkm.market2_0.m_imple.steelyardserver.server.ReceiveTask;



public class SetSteelyardRepairingTask extends AbsSendWriteTask {

    

    public SetSteelyardRepairingTask(ITaskExecutor<Object[], Void, Boolean> taskExecutor, TaskManager mTaskManager, IHardwareControler bluetoothSocket, ReceiveTask mReceiveTask) {
        super(taskExecutor, SetSteelyardRepairingTask.class.getName(), mTaskManager, bluetoothSocket,mReceiveTask);
    }
    int pass=0;

    @Override
    protected byte onGetRequestCMD(int[] outDataSize) {
        outDataSize[0]=pass=0;

        return 0x07;
    }

    private static byte[] datas=new byte[]{0x3e,0x4e,0x5e,0x76,0x7f,(byte)0x8d,(byte)0xa9,0x10,0x3a,0x3e,(byte)0xa9,0x3e};
    @Override
    protected byte[] onGetRequestCMDContent() {
        
//        return DataEncryptionHelp.Encrypt(datas,pass,datas.length);
        return new byte[]{0x33,0x3e,0x34,0x3e,0x35,0x3e,0x37,0x36,0x37,0x3f,0x38,0x3d,0x3a,0x39,0x31,0x30,0x33,0x3a, 0x33,0x3e ,0x3a,0x39, 0x33,0x3e};
    }


    @Override
    protected byte[] onGetSendDataItem(int index) {
        return null;
    }


    @Override
    public void onPreExecute() {
        super.onPreExecute();

        if(P.isDebug()) {
            P.p("=======开始设置台秤为维修中");
            if(UIP.isPrint()){
                UIP.p("Send设置台秤为维修中：开始",mReceiveTask==null?"":mReceiveTask.steelyardMac);
            }
        }
    }
    @Override
    public void onCancel() {
        super.onCancel();

        if(P.isDebug()) {
            P.p("=======设置台秤为维修中 取消了");
            if(UIP.isPrint()){
                UIP.p("Send设置台秤为维修中：取消",mReceiveTask==null?"":mReceiveTask.steelyardMac);
            }
        }
    }
    @Override
    public void onFinish(Boolean aBoolean) {
        super.onFinish(aBoolean);

        if(P.isDebug()) {
            P.p("======设置台秤为维修中是否成功："+aBoolean);
            if(UIP.isPrint()){
                UIP.p("Send设置台秤为维修中：成功？"+aBoolean,mReceiveTask==null?"":mReceiveTask.steelyardMac);
            }
        }
    }
}